﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Test.DAL.Abstracts.ApplicationFeature;
using Test.Service.Abstracts.ApplicationFeature.EventData;
using TianShu.DependencyInjection;
using TianShu.EventBus.Distributed;

namespace Test.Service.ApplicationFeature.EventHandles
{
    public class AppCreateEventHandle : IDistributedEventHandler<AppCreateEventData>, ITransientDependency
    {
        private readonly IApplicationDal _appDal;
        public AppCreateEventHandle(IApplicationDal appDal)
        {
            _appDal = appDal;
        }
        public async Task HandleEventAsync(AppCreateEventData eventData)
        {
            await _appDal.Insert(new Domain.Entities.EAMApplicationEntity
            {
                Name = eventData.Name
            });
        }
    }
}
